var ln = {
    createDom:(function () {
        var wrap = {
            option:[1, '<select multiple="multiple">', '</select>'],
            optgroup:[1, '<select multiple="multiple">', '</select>'],
            legend:[1, '<fieldset>', '</fieldset>'],
            thead:[1, '<table>', '</table>'],
            tbody:[1, '<table>', '</table>'],
            tfoot:[1, '<table>', '</table>'],
            tr:[2, '<table><tbody>', '</tbody></table>'],
            td:[3, '<table><tbody><tr>', '</tr></tbody></table>'],
            th:[3, '<table><tbody><tr>', '</tr></tbody></table>'],
            col:[2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
            _default:[0, '', '']
        };
        return function (html) {
            var htmlTag = html.match(/<(\w+)/i);
            if (!htmlTag) return;
            var wraper = wrap[htmlTag[1]] || wrap._default,
                dep = wraper[0],
                frag = document.createDocumentFragment(),
                temp = document.createElement('div'),
                node = null;
            temp.innerHTML = wraper[1] + html + wraper[2];
            if (dep) {
                while (dep--) {
                    temp = temp.firstChild;
                }
            }
            while (node = temp.firstChild) {
                frag.appendChild(node);
            }
            return frag;
        };
    }()),
    setHtml:function (element, html) {
        var mustAppend = /<(?:object|embed|option|style)/i;
        if (!mustAppend.test(element.tagName)) {
            element.innerHTML = html;
        } else {
            //ln.empty(element);
            element.appendChild(ln.createDom(html));
        }
    },
    setText:function (element, text) {
        if (element.innerText) {
            element.innerText = text;
        } else {
            element.textContent = text;
        }
    }
};